/**
 * @param {number[][]} times
 * @param {number} targetFriend
 * @return {number}
 */
 var smallestChair = function(times, targetFriend) {
    const [s, e] = times[targetFriend]
    const arr = times.filter(item => item[0] <= s)
    arr.sort((a,b) => a[0]-b[0])
    const n = arr.length
    const chair = new Array(n).fill([-1,0])
    let ans = 0
    for(const [x ,y] of arr){
        for(let i = 0;i<n; i++){
            const [xx,yy] = chair[i] 
            if(x >= yy){
                chair[i] = [x,y]
                ans = i
                break;
            }
        }
    }
    console.log(chair)
    return ans
};